<!--
- Author:   .
- Date:    2017/7/17 0017.
- File:    step1.
-->
<template>
  <div>
    <div class="p20 bg_fff apply_box" v-show="refundInfo.info.seller_state == $dictionary.refundStatus.resolve">
      <h3>请退货给商家</h3>
      <div class="apply_text lh20">退货地址：{{refundInfo.address.area_info}}{{refundInfo.address.address}}{{refundInfo.address.company}}</div>
      <div class="apply_text lh20">收件人：{{refundInfo.address.seller_name}}</div>
      <div class="apply_text lh20">联系电话：{{refundInfo.address.telphone}}</div>
      <div class="apply_text lh20" style="color: red">退款说明：拒收到付快递</div>

      <div class="apply_sel3 mt20">
        <button @click="addExpress" v-show="refundInfo.info.express_id == 0">填写退货物流</button>
        <button @click="gotoRefundExpress(refundInfo.info.refund_id)" v-show="refundInfo.info.express_id != 0">查看退货物流</button>
      </div>
    </div>
    <div class="apply_li mt20">
      <ul>
        <li>换货状态：<span class="cr_41a536">{{refundInfo.info.seller_state | refundStatusName}}</span></li>
        <li>换货类型：退款换货</li>
        <li>换货编号： {{refundInfo.info.refund_sn}}</li>
        <li>换货原因： {{refundInfo.info.reason_info}}</li>
        <li>换货金额： ¥{{refundInfo.info.refund_amount}}</li>
        <li>换货数量： {{refundInfo.info.goods_num}}</li>
        <li>换货说明： {{refundInfo.info.buyer_message}}</li>
        <li>商家备注： {{refundInfo.info.seller_message}}</li>
      </ul>
    </div>
    <div class="apply_sel2 p20">
      <button @click="goBack">返回上一页</button>
    </div>
  </div>
</template>

<script>
  import * as dictionary from '../../../dictionary'
  export default{
    data() {
      return {
        refundId: this.$route.params.id,
        refundInfo: {address: {}, express: null, info: {}}
      }
    },
    components: {},
    created() {
      this.getRefundInfo(this.refundId)
    },
    filters: {
      refundStatusName: function (value) {
        let name = ''
        switch (value) {
          case dictionary.refundStatus.waiting:
            name = '等待审核'
            break
          case dictionary.refundStatus.resolve:
            name = '卖家已同意'
            break
          case dictionary.refundStatus.reject:
            name = '卖家已拒绝'
            break
        }
        return name
      }
    },
    methods: {
      gotoRefundExpress(id) {
        this.$router.push({name: 'refund-goods-express-detail', params: {id: id}})
      },
      goBack() {
        this.$router.go(-1)
      },
      getRefundInfo(id) {
        this.$request.getRefundInfo(id).then(data => {
          this.refundInfo = data
        })
      },
      addExpress() {
        this.$router.push({name: 'refund-goods-express-add', query: {refundId: this.refundInfo.info.refund_id}})
      }
    }
  }
</script>

<style>
 .lh20{
   line-height: 1rem !important;
 }
</style>